package cn.manyufun.myf.common.commonwidget;

import android.content.Context;
import android.support.design.widget.CoordinatorLayout;
import android.util.AttributeSet;
import android.widget.ImageView;
import android.widget.ProgressBar;

import cn.manyufun.myf.R;
import cn.manyufun.myf.common.commonutils.ImageLoaderUtils;

/**
 * Created by Xiao on 2018-02-03.
 */

public class MYFProgressBar extends CoordinatorLayout {
    private final ProgressBar progressBar;
    private final ImageView ivCenter;

    public MYFProgressBar(Context context) {
        this(context, null);
    }

    public MYFProgressBar(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }

    public MYFProgressBar(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        inflate(context, R.layout.myf_progress_bar, this);

        progressBar = findViewById(R.id.progressbar);
        ivCenter = findViewById(R.id.iv_refresh_center);

        ImageLoaderUtils.displayRound(context, ivCenter, R.drawable.ic_fresh_center);
    }

    public void setIndeterminate(boolean indeterminate) {
        this.progressBar.setIndeterminate(indeterminate);
    }
}
